package com.erp.remote.information;

import com.erp.util.AjaxResult;
import com.erp.util.AmountDTO;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashSet;
import java.util.List;
import java.util.Map;

@RequestMapping("/information/provider")
public interface ProviderRemote {


    /**
     * 获取全部客户的数据
     *
     * @return
     */
    @RequestMapping("/allProvider")
    AjaxResult allProvider(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize);


    /**
     * 根据供应商的编号，名称，联系人，电话模糊查询客户
     *
     * @param params
     * @return
     */
    @RequestMapping("/getProviderByDescription")
    AjaxResult getProviderByDescription(@RequestBody Map<String, Object> params);


    @PostMapping("/addProvider")
    AjaxResult addProvider(@RequestBody Map<String, Object> params);

    /**
     * 用于在新增时，根据providerCode验证供应商是否唯一
     *
     * @param providerCode
     * @return
     */
    @RequestMapping("/checkProviderOnly")
    AjaxResult checkProviderOnly(@RequestParam("providerCode") String providerCode);


    /**
     * 启用供应商
     *
     * @param params
     * @return
     */
    @PostMapping("/enableProvider")
    AjaxResult enableProvider(@RequestBody Map<String, Object> params);

    /**
     * 禁用供应商
     *
     * @param params
     * @return
     */
    @PostMapping("/disableProvider")
    AjaxResult disableProvider(@RequestBody Map<String, Object> params);

    /**
     * 删除供应商--逻辑删除
     *
     * @param params
     * @return
     */
    @PostMapping("/deleteProvider")
    AjaxResult deleteProvider(@RequestBody Map<String, Object> params);

    @RequestMapping("/selectContanterByProviderId")
    AjaxResult selectContanterByProviderId(@RequestParam("providerId") Integer providerId);

    @PostMapping("/updateProviderAndContanter")
    AjaxResult updateProviderAndContanter(@RequestBody Map<String, Object> param);


    //批量修改客户数据
    @PostMapping("/batchUpdate")
    AjaxResult batchUpdate(@RequestBody Map<String, Object> params);


    @RequestMapping("/selectProviderByCompanyId")
    AjaxResult selectProviderByCompanyId(@RequestParam("companyId") Integer companyId);


    @PostMapping("/selectProviderInIDSet")
    AjaxResult selectProviderInIDSet(@RequestBody HashSet<Integer> providerIds);


    @RequestMapping("/selectProviderByCompanyIdPage")
    AjaxResult selectProviderByCompanyIdPage(@RequestBody Map<String,Object> params);

    /**
     * 修改供应商余额
     */
    @PostMapping("/updateProviderPayableBalance")
    AjaxResult updateProviderPayableBalance(@RequestBody Map<String, Object> params);

    /**
     * 批量修改
     * @param list
     * @return
     */
    @PostMapping("/batchUpdateBalance")
    AjaxResult batchUpdateBalance(@RequestBody List<AmountDTO> list);

    /**
     * 计算供应商总欠款
     * @param companyId
     * @return
     */
    @PostMapping("/selectProviderPayableBalance")
    AjaxResult selectProviderPayableBalance(@RequestParam("companyId") Integer companyId);
}
